<script type="text/javascript">
	if(window.opener && getQueryString('type') === 'login'){
		window.opener.location.reload();
	}
	if(getQueryString('type') === 'login'){
		window.opener=null;
	    window.open('','_self');
		window.close();
	}
	const is_weixin = (function(){return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1})();
	function getCookie(name){
	    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
	    if(arr=document.cookie.match(reg)){
	        return unescape(arr[2]);
	    }else{
	    	return null
	    }
	}
	
	function removeCookie(name) { 
        document.cookie=name+"="+''+"; expire="+(new Date(0).toGMTString())+"; path=/; domain=.1234tv.com";
	}
	function IsPC() {
	    var userAgentInfo = navigator.userAgent;
	    var Agents = ["Android", "iPhone",
	                "SymbianOS", "Windows Phone",
	                "iPad", "iPod"];
	    var flag = true;
	    for (var v = 0; v < Agents.length; v++) {
	        if (userAgentInfo.indexOf(Agents[v]) > 0) {
	            flag = false;
	            break;
	        }
	    }
	    return flag;
	}	
	function getQueryString(name) {
	    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
	    var r = window.location.search.substr(1).match(reg);
	    if (r != null) {
	        return unescape(r[2]);
	    }
	    return null;
	}
	export default {
		is_weixin,
		getCookie,
		IsPC,
		removeCookie,
		getQueryString
	}
</script>
